<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>产品中心管理</title>
<link rel="stylesheet" type="text/css" href="../css/admin/base.css">
<script language="javascript">
	function viewArc(aid) {
		if (aid == 0)
			aid = getOneItem();
		window.open("archives.asp?aid=" + aid + "&action=viewArchives");
	}
	function editArc(aid) {
		if (aid == 0)
			aid = getOneItem();
		location = "archives.asp?aid=" + aid + "&action=editArchives";
	}
	function updateArc(aid) {
		var qstr = getCheckboxItem();
		if (aid == 0)
			aid = getOneItem();
		location = "archives.asp?aid=" + aid + "&action=makeArchives&qstr="
				+ qstr + "";
	}
	function checkArc(aid) {
		var qstr = getCheckboxItem();
		if (aid == 0)
			aid = getOneItem();
		location = "archives.asp?aid=" + aid + "&action=checkArchives&qstr="
				+ qstr + "";
	}
	function moveArc(aid) {
		var qstr = getCheckboxItem();
		if (aid == 0)
			aid = getOneItem();
		location = "archives.asp?aid=" + aid + "&action=moveArchives&qstr="
				+ qstr + "";
	}
	function adArc(aid) {
		var qstr = getCheckboxItem();
		if (aid == 0)
			aid = getOneItem();
		location = "archives.asp?aid=" + aid + "&action=commendArchives&qstr="
				+ qstr + "";
	}
	function delArc(aid) {
		var qstr = getCheckboxItem();
		if (aid == 0)
			aid = getOneItem();
		location = "archives.asp?aid=" + aid + "&action=delArchives&qstr="
				+ qstr + "";
	}

	//获得选中文件的文件名
	function getCheckboxItem() {
		var allSel = "";
		if (document.form2.id.value)
			return document.form2.id.value;
		for (i = 0; i < document.form2.id.length; i++) {
			if (document.form2.id[i].checked) {
				if (allSel == "")
					allSel = document.form2.id[i].value;
				else
					allSel = allSel + "`" + document.form2.id[i].value;
			}
		}
		return allSel;
	}

	//获得选中其中一个的id
	function getOneItem() {
		var allSel = "";
		if (document.form2.id.value)
			return document.form2.id.value;
		for (i = 0; i < document.form2.id.length; i++) {
			if (document.form2.id[i].checked) {
				allSel = document.form2.id[i].value;
				break;
			}
		}
		return allSel;
	}
	function selAll() {
		for (i = 0; i < document.form2.id.length; i++) {
			if (!document.form2.id[i].checked) {
				document.form2.id[i].checked = true;
			}
		}
	}
	function noSelAll() {
		for (i = 0; i < document.form2.id.length; i++) {
			if (document.form2.id[i].checked) {
				document.form2.id[i].checked = false;
			}
		}
	}
</script>
</head>
<body leftmargin="8" topmargin="8"
	background='../images/admin/allbg.gif'>
	
	<?php


	$id=$_GET['id'];
	$type=$_GET['type'];

	if($type == "delete"){
		require_once("../conn.php"); 
		$sql = "delete from t_app_product where id=".$id;
		$rs = mysql_query($sql);
	}

?>

	<!--  快速转换位置按钮  -->
	<table width="98%" border="0" cellpadding="0" cellspacing="1"
		bgcolor="#D1DDAA" align="center">
		<tr>
			<td height="26" background="../images/admin/newlinebg3.gif">
				<table width="98%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td align="center"><input type='button' class="coolbg np"
							onClick="location='productsedit.php?type=insert';" value='添加产品' />
							 <!-- <input type='button' class="coolbg np" onClick="location='';" value='我的文档' />
    <input type='button' class='coolbg np' onClick="location='';" value='稿件审核' />
    <input type='button' class="coolbg np" onClick="location='';" value='栏目管理' /> -->
							<!--<input type='button' class="coolbg np" onClick="location='';"
							value='更新列表' /> <input type='button' class="coolbg np"
							onClick="location='';" value='更新文档' /> 
							 <input type='button' class="coolbg np" onClick="location='';" value='文章回收站' /> -->
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>

	<!--  内容列表   -->
	<form name="form2">

		<table width="98%" border="0" cellpadding="2" cellspacing="1"
			bgcolor="#D1DDAA" align="center" style="margin-top: 8px">
			<tr bgcolor="#E7E7E7">
				<td height="24" colspan="10" background="../images/admin/tbg.gif">&nbsp;文档列表&nbsp;</td>
			</tr>
			<tr align="center" bgcolor="#FAFAF1" height="22">
				<td width="6%">ID</td>
				<td width="4%">选择</td>
				<td width="20%">产品中心</td>
				<td width="20%">产品标题</td>
				<td width="20%">产品图片</td>
				<td width="20%">提交者</td>
				<td width="10%">操作</td>
			</tr>

			<?php
							require_once("../conn.php"); 
							$sql = "select * from v_app_product order by code,id ";
							$rs = mysql_query($sql);
							while($row=mysql_fetch_array($rs)){

							$id=$row["id"];
							$productName=$row["productName"];
							$pictureName=$row["pictureName"];
							$value=$row["value"];
						    $encode="utf-8";
							echo "<tr align='center' bgcolor='#FFFFFF'
									onMouseMove='javascript:this.bgColor='#FCFDEE';'
									onMouseOut='javascript:this.bgColor='#FFFFFF';' height='22px'>
									<td>$id</td>
									<td><input name='id' type='checkbox' id='id' value='101' class='np'></td> 
									<td style='text-align:left;'>$value</td>
									<td style='text-align:left;'>$productName</td>
									<td>$pictureName</td>
									<td>admin</td>
									<td><a href='productsedit.php?id=$id&type=update'>编辑</a> | <a href='products.php?id=$id&type=delete'>删除</a></td>
									</tr>";
							}
					?>


			<tr align="right" bgcolor="#EEF4EA">
				<td height="36" colspan="10" align="center">
					<!--翻页代码 -->
				</td>
			</tr>
		</table>

	</form>

</body>
</html>